package com.endava.dao;

import java.util.List;

import com.endava.model.Employee;
import com.endava.model.Login;

/**
 * Contract used by DAO layer to make operations over database schema.
 * 
 * @author acojocar
 * 
 */
public interface UsersDao {

	public static final String SELECT_BY_CREDENTIALS = "from Login where USERNAME = :username and PASSWORD = :password";
	public static final String SELECT_USER_DETAILS = "select emp.firstName, emp.lastName, emp.department, emp.salary, log from Employee emp, Login log where emp.id = log.id and log.username = :username";
	public static final String SELECT_ALL_EMPLOYEES = "from Employee";
	public static final String SELECT_BY_ID = "from Employee where ID = :id";
	public static final String UPDATE_EMPLOYEE = "update Employee emp set emp.department = :department, emp.salary = :salary where emp.id = :id";
	
	/**
	 * Gets the user from database by it's credentials.
	 * 
	 * @param username
	 *            credential
	 * @param password
	 *            credential
	 * @return <code>Login</code> bean
	 */
	public Login getUserFromDb(String username, String password);

	/**
	 * Gets a list of all employees from database.
	 * 
	 * @return <code>List</code> of <code>Employee</code> bean
	 */
	public List<Employee> getAllEmployees();

	/**
	 * Gets the <code>Employee</code> data from database by it's
	 * <code>Login</code> credential.
	 * 
	 * @param username
	 *            credential
	 * @return <code>Employee</code> bean
	 */
	public Employee getUserData(String username);
	
	public Employee deleteEmployeeById(int id);
	
	public Employee getEmployeeById(int id);
	
	public Employee updateEmployeeData(int id, String department, double salary);

}
